package io.gitee.macxiang.sql.wapper;

import io.gitee.macxiang.utils.SQL;

public class SetField<S extends BaseSet> {
  final S service;
  final String fieldName;

  /**数据库操作
   * @param service   服务自身this
   * @param fieldName 数据库字段名
   */
  public SetField(S service, String fieldName) {
    this.service = service;
    this.fieldName = fieldName;
  }

  public S set(Object value) {
    service.list.add(String.format("%s = %s", fieldName, SQL.safeJSON(value)));
    return service;
  }
}
